package com.xiaoyun.config;

import com.xiaoyun.service.OrderService;
import com.xiaoyun.utils.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
@Slf4j
@RequiredArgsConstructor
public class OrderJon {
    private final OrderService orderService;

    //延时队列
//    @Scheduled(cron = "0/3 * * * * ? ")
    public void autoCloseOrder() {
        log.info("执行定时任务,当前时间未:{}", DateUtil.getCurrentDateString(DateUtil.DATE_PATTERN));
        orderService.closeOrder();
    }
}
